﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Base.Master" Inherits="System.Web.Mvc.ViewPage(Of DailyReport.DepartmentCheckReportByBusinessModel)" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    DepartmentCheckReport
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%
        Dim nbcm As Ext.Net.MenuItem
        
        dcCheckBusiness.Reader.Clear()
        
        '创建第一个DataField
        Dim njr As New JsonReader
        njr.Root = "data"
        njr.TotalProperty = "total"
        njr.Fields.Add("UserName")

        '创建第一个Column
        Dim nc As New Column With {.ColumnID = "UserName",
                                  .Header = "名称",
                                  .DataIndex = "UserName"}
        gpBusiness.ColumnModel.Columns.Add(nc)
        
        For Each b In Model.Businesses.BusinessList
            '创建DataField
            njr.Fields.Add(b.Value)
            
            '创建Column
            nc = New Column With {.ColumnID = b.Value,
                                  .Header = b.Name,
                                  .DataIndex = b.Value}
            gpBusiness.ColumnModel.Columns.Add(nc)
            
            '
            nbcm = New Ext.Net.MenuItem With {.Text = b.Name, .ID = String.Concat("bcm_", b.Value), .Icon = Icon.ShapeAlignBottom}
            BusinessChartMenu.Add(nbcm)
        Next
        dcCheckBusiness.Reader.Add(njr)
        
        Dim startDate As Date
        Dim endDate As Date
        Dim inDate As Date = Now
        
        If inDate.Day <= 28 Then
            If inDate.Month = 3 Then
                If (Date.Parse(inDate.ToString("yyyy-MM") + "-1")).AddDays(-1).Day = 29 Then
                    startDate = New Date(inDate.Year, inDate.AddMonths(-1).Month, 29)
                Else
                    startDate = New Date(inDate.Year, inDate.Month, 1)
                End If
            Else
                startDate = Date.Parse(inDate.AddMonths(-1).ToString("yyyy-MM") + "-29")
            End If
            endDate = Date.Parse(inDate.ToString("yyyy-MM") + "-28")
        Else
            startDate = Date.Parse(inDate.ToString("yyyy-MM") + "-29")
            endDate = Date.Parse(inDate.AddMonths(1).ToString("yyyy-MM") + "-28")
        End If
        
        Dim reportType As String = "部门"
        If Not DailyReport.DailyReportCommon.MatchingPermission(DailyReport.DailyReportCommon.CurrentUserPermissions, DailyReport.DailyReportCommon.PermissionList.审核报表) Then
            btnBusinessCompare.Hide()
            reportType = DailyReport.DailyReportCommon.CurrentUserName
        End If
    %>
    <script type="text/javascript">
        var _userid = '<%=ViewData("UserID") %>';
        var _checkdate = '<%=ViewData("CheckDate") %>';
        var _rangestart = new Date('<%= startDate.toString("MM/dd/yyyy")%>');
        var _rangeend = new Date('<%= endDate.toString("MM/dd/yyyy")%>');
        var _reportType = '<%= reportType %>';
        var _username = '<%=DailyReport.DailyReportCommon.CurrentUserName %>';
        var _printTitle = [formatCNDate(_rangestart), '至 ', formatCNDate(_rangeend), _reportType + '业务统计'].join(' ');
        var _level = '<%=ViewData("Level") %>';
        var _leveltext = '一审';
    </script>
    <ext:Viewport ID="ViewPort1" runat="server" Layout="fit">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Header="false" Border="false" Layout="FitLayout">
                <TopBar>
                    <ext:Toolbar ID="toolbar3" runat="server">
                        <Items>
                            <ext:TabStrip ID="TabStrip1" runat="server">
                                <Items>
                                    <ext:TabStripItem ActionItemID="pnlBusiness" runat="server" Title="业务视图" />
                                    <ext:TabStripItem ActionItemID="pnlMember" runat="server" Title="人员视图" />
                                </Items>
                            </ext:TabStrip>
                            <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server" />
                            <%--<ext:SelectBox ID="sltRange" runat="server" DisplayField="text" ValueField="value">
                                <Store>
                                    <ext:Store runat="server" ID="dcRange">
                                        <Proxy>
                                            <ext:HttpProxy runat="server" Url="/Setting/ReportRange.xml" />
                                        </Proxy>
                                        <Reader>
                                            <ext:XmlReader Record="item">
                                                <Fields>
                                                    <ext:RecordField Name="value" Mapping="@value" />
                                                    <ext:RecordField Name="text" Mapping="@text" />
                                                </Fields>
                                            </ext:XmlReader>
                                        </Reader>
                                        <Listeners>
                                            <Load Handler="sltRange.selectFirst();" />
                                        </Listeners>
                                    </ext:Store>
                                </Store>
                                <Listeners>
                                    <Select Fn="rangeSelected" />
                                </Listeners>
                            </ext:SelectBox>--%>
                            <ext:Label ID="Label1" runat="server" Text="统计：">
                            </ext:Label>
                            <ext:SelectBox ID="sltLevel" runat="server" DisplayField="text" ValueField="value"
                                Width="80">
                                <Items>
                                    <ext:ListItem Text="一审" Value="1" />
                                    <ext:ListItem Text="二审" Value="2" />
                                    <ext:ListItem Text="三审" Value="3" />
                                    <ext:ListItem Text="审核会签" Value="4" />
                                    <ext:ListItem Text="地价会签" Value="5" />
                                    <ext:ListItem Text="总量" Value="0" />
                                </Items>
                                <Listeners>
                                    <Render Handler="item.setValue(_level);" />
                                    <Select Handler="_level = record.data.value;_leveltext = record.data.text;" />
                                </Listeners>
                            </ext:SelectBox>
                            <ext:Label ID="Label4" runat="server" Text="&nbsp;从&nbsp;" />
                            <ext:DateField ID="drFrom" runat="server" Vtype="daterange" AnchorHorizontal="100%"
                                Format="yyyy-MM-dd">
                                <Listeners>
                                    <Render Handler="item.setValue(_rangestart);" />
                                    <Change Handler="_rangestart = newValue;" />
                                </Listeners>
                                <CustomConfig>
                                    <ext:ConfigItem Name="endDateField" Value="#{DateField2}" Mode="Value" />
                                </CustomConfig>
                            </ext:DateField>
                            <ext:Label ID="Label2" runat="server" Text="&nbsp;至&nbsp;" />
                            <ext:DateField ID="drTo" runat="server" Vtype="daterange" AnchorHorizontal="100%"
                                Format="yyyy-MM-dd">
                                <Listeners>
                                    <Render Handler="item.setValue(_rangeend);" />
                                    <Change Handler="_rangeend = newValue;" />
                                </Listeners>
                                <CustomConfig>
                                    <ext:ConfigItem Name="startDateField" Value="#{DateField1}" Mode="Value" />
                                </CustomConfig>
                            </ext:DateField>
                            <ext:Label ID="Label3" runat="server" Text="&nbsp;" />
                            <ext:Button ID="btnReload" runat="server" Text="刷新" Icon="Reload">
                                <Listeners>
                                    <Click Handler="gpBusiness.reload();gpMember.reload();" />
                                </Listeners>
                            </ext:Button>
                            <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server" />
                            <ext:Button ID="btnWorkloadTrendsChar" runat="server" Text="工作量走势" Icon="ChartCurve">
                                <Menu>
                                    <ext:Menu ID="WorkloadTrendsCharMenu" runat="server">
                                        <Items>
                                            <ext:MenuItem Text="日视图">
                                                <Listeners>
                                                    <Click Handler="showWorkloadTrendsChart(1);" />
                                                </Listeners>
                                            </ext:MenuItem>
                                            <ext:MenuItem Text="月视图">
                                                <Listeners>
                                                    <Click Handler="showWorkloadTrendsChart(2);" />
                                                </Listeners>
                                            </ext:MenuItem>
                                        </Items>
                                    </ext:Menu>
                                </Menu>
                            </ext:Button>
                            <ext:Button ID="btnWorkloadProportionChar" runat="server" Text="工作量比例" Icon="ChartPie">
                                <Listeners>
                                    <Click Handler="showWorkloadProportionChart();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnBusinessCompare" runat="server" Text="业务量比较" Icon="ChartBar">
                                <Menu>
                                    <ext:Menu ID="BusinessChartMenu" runat="server">
                                        <Listeners>
                                            <Click Fn="showBusinessChart" />
                                        </Listeners>
                                    </ext:Menu>
                                </Menu>
                                <Listeners>
                                </Listeners>
                            </ext:Button>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                            <ext:Button ID="btnPrint" runat="server" Text="打印" Icon="Printer">
                                <Listeners>
                                    <Click Handler="$(gpBusiness).printArea({ mode: 'popup', popClose: true,strict: true,popTitle:_printTitle,popOwn:_username });" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:Panel ID="pnlBusiness" runat="server" Header="false" BodyBorder="false" Frame="false"
                        Layout="FitLayout">
                        <Content>
                            <ext:GridPanel ID="gpBusiness" runat="server" AutoExpandColumn="UserName" Header="false"
                                Border="false" TrackMouseOver="true" StripeRows="true" Layout="FitLayout" AutoWidth="true">
                                <Store>
                                    <ext:Store ID="dcCheckBusiness" runat="server">
                                        <Proxy>
                                            <ext:HttpProxy Url="/Day/GetDepartmentCheckListByBusinessStore/" />
                                        </Proxy>
                                        <BaseParams>
                                            <ext:Parameter Name="rangestart" Value="_rangestart" Mode="Raw" />
                                            <ext:Parameter Name="rangeend" Value="_rangeend" Mode="Raw" />
                                            <ext:Parameter Name="level" Value="_level" Mode="Raw" />
                                        </BaseParams>
                                    </ext:Store>
                                </Store>
                                <ColumnModel ID="ColumnModel2" runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Width="25" Resizable="false" />
                                    </Columns>
                                    <Listeners>
                                    </Listeners>
                                </ColumnModel>
                                <TopBar>
                                    <ext:Toolbar ID="Toolbar2" runat="server">
                                    </ext:Toolbar>
                                </TopBar>
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" />
                                </SelectionModel>
                                <Listeners>
                                    <Command Fn="commandHandler" />
                                </Listeners>
                                <LoadMask ShowMask="true" />
                                <SaveMask ShowMask="true" />
                            </ext:GridPanel>
                        </Content>
                    </ext:Panel>
                    <ext:Panel ID="pnlMember" runat="server" Header="false" BodyBorder="false" Frame="false"
                        Layout="FitLayout">
                        <Content>
                            <ext:GridPanel ID="gpMember" runat="server" AutoExpandColumn="UserName" Header="false"
                                Border="false" TrackMouseOver="true" StripeRows="true" Layout="FitLayout">
                                <Store>
                                    <ext:Store ID="dcCheckMember" runat="server" UseIdConfirmation="true">
                                        <Proxy>
                                            <ext:HttpProxy Url="/Day/GetDepartmentCheckListByLevelStore/" />
                                        </Proxy>
                                        <BaseParams>
                                            <ext:Parameter Name="rangestart" Value="_rangestart" Mode="Raw" />
                                            <ext:Parameter Name="rangeend" Value="_rangeend" Mode="Raw" />
                                            <ext:Parameter Name="level" Value="_level" Mode="Raw" />
                                        </BaseParams>
                                        <Reader>
                                            <ext:JsonReader IDProperty="id" Root="data" TotalProperty="total">
                                                <Fields>
                                                    <ext:RecordField Name="Level1" />
                                                    <ext:RecordField Name="Level2" />
                                                    <ext:RecordField Name="Level3" />
                                                    <ext:RecordField Name="Level4" />
                                                    <ext:RecordField Name="Level5" />
                                                    <ext:RecordField Name="UserName" />
                                                    <ext:RecordField Name="UserID" />
                                                    <ext:RecordField Name="Total" />
                                                </Fields>
                                            </ext:JsonReader>
                                        </Reader>
                                        <SortInfo Field="UserName" Direction="DESC" />
                                        <Listeners>
                                            <%--<Load Handler="updateTotal(#{gpMember});" />--%>
                                        </Listeners>
                                    </ext:Store>
                                </Store>
                                <ColumnModel ID="ColumnModel1" runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Width="25" Resizable="false" />
                                        <ext:CommandColumn Width="25" Hideable="false" Resizable="false">
                                            <Commands>
                                                <ext:GridCommand CommandName="userreport" Icon="ApplicationFormEdit">
                                                    <ToolTip Text="个人报表" />
                                                </ext:GridCommand>
                                            </Commands>
                                            <PrepareToolbar Handler="toolbar.setVisible(!record.newRecord);" />
                                        </ext:CommandColumn>
                                        <ext:GroupingSummaryColumn Header="名称" DataIndex="UserName" Width="130" SummaryType="Count">
                                            <SummaryRenderer Handler="return ((value === 0 || value > 1) ? value +' 人' : '1 人');" />
                                        </ext:GroupingSummaryColumn>
                                        <ext:GroupingSummaryColumn Header="一审" DataIndex="Level1" Width="130" SummaryType="Sum" />
                                        <ext:GroupingSummaryColumn Header="二审" DataIndex="Level2" Width="130" SummaryType="Sum" />
                                        <ext:GroupingSummaryColumn Header="三审" DataIndex="Level3" Width="130" SummaryType="Sum" />
                                        <ext:GroupingSummaryColumn Header="审核会签" DataIndex="Level4" Width="130" SummaryType="Sum" />
                                        <ext:GroupingSummaryColumn Header="地价会签" DataIndex="Level5" Width="130" SummaryType="Sum" />
                                        <%--<ext:GroupingSummaryColumn Header="小计" DataIndex="Total" SummaryType="Sum" />--%>
                                    </Columns>
                                    <Listeners>
                                        <%--<WidthChange Handler="updateTotal(#{gpMember});" />--%>
                                    </Listeners>
                                </ColumnModel>
                                <TopBar>
                                    <ext:Toolbar ID="Toolbar1" runat="server">
                                    </ext:Toolbar>
                                </TopBar>
                                <%--<Plugins>
                            <ext:GroupingSummary ID="GroupingSummary1" runat="server" />
                        </Plugins>--%>
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                                </SelectionModel>
                                <Listeners>
                                    <Command Fn="commandHandler" />
                                    <%--<ColumnResize Handler="updateTotal(#{gpMember});" />--%>
                                </Listeners>
                                <LoadMask ShowMask="true" />
                                <SaveMask ShowMask="true" />
                                <Plugins>
                                    <%--<ext:GroupingSummary ID="GroupingSummary1" runat="server">
                        <Calculations>
                            <ext:JFunction Name="totalCost" Handler="return v + (record.data.Estimate * record.data.Rate);" />
                        </Calculations>
                    </ext:GroupingSummary>--%>
                                </Plugins>
                                <%--<BottomBar>
                            <ext:Toolbar ID="Toolbar2" runat="server">
                                <Items>
                                    <ext:DisplayField ID="DisplayField1" runat="server" Width="50" />
                                    <ext:DisplayField ID="ColumnField1" runat="server" DataIndex="UserName" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="ColumnField2" runat="server" DataIndex="Level1" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="ColumnField3" runat="server" DataIndex="Level2" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="ColumnField4" runat="server" DataIndex="Level3" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="ColumnField5" runat="server" DataIndex="Level4" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="ColumnField6" runat="server" DataIndex="Level5" Cls="total-field"
                                        Text="-" />
                                    <ext:DisplayField ID="DisplayField7" runat="server" DataIndex="Total" Cls="total-field"
                                        Text="-" />
                                </Items>
                            </ext:Toolbar>
                        </BottomBar>--%>
                            </ext:GridPanel>
                        </Content>
                    </ext:Panel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
    <ext:Window ID="UserCheckDetailsWindow" runat="server" Icon="ApplicationFormEdit"
        Width="800" Height="600" Hidden="true" Modal="true" Constrain="true">
        <AutoLoad Url="/Day/CheckDetail/" Mode="IFrame" TriggerEvent="show" ReloadOnEvent="true"
            ShowMask="true">
            <Params>
                <ext:Parameter Name="userid" Value="" Mode="Value" />
                <ext:Parameter Name="username" Value="" Mode="Value" />
                <ext:Parameter Name="range" Value="" Mode="Value" />
            </Params>
        </AutoLoad>
        <Buttons>
            <ext:Button ID="Button1" runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{UserCheckDetailsWindow}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
        <Listeners>
            <%--<Hide Handler="if(this.getBody().customerChanged) { dsCustomers.reload(); };" />--%>
        </Listeners>
    </ext:Window>
    <ext:Window ID="WorkloadTrendsChartWindow" runat="server" Icon="ChartLine" Width="900"
        Height="600" Hidden="true" Modal="true" Constrain="true">
        <AutoLoad Url="/Day/WorkloadTrendsChart/" Mode="IFrame" TriggerEvent="show" ReloadOnEvent="true"
            ShowMask="true">
            <Params>
                <ext:Parameter Name="range" Value="" Mode="Value" />
            </Params>
        </AutoLoad>
        <Buttons>
            <ext:Button ID="Button3" runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{WorkloadTrendsChartWindow}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    <ext:Window ID="WorkloadProportionChartWindow" runat="server" Icon="ChartPie" Width="900"
        Height="600" Hidden="true" Modal="true" Constrain="true">
        <AutoLoad Url="/Day/WorkloadProportionChart/" Mode="IFrame" TriggerEvent="show" ReloadOnEvent="true"
            ShowMask="true">
            <Params>
                <ext:Parameter Name="range" Value="" Mode="Value" />
            </Params>
        </AutoLoad>
        <Buttons>
            <ext:Button ID="Button4" runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{WorkloadProportionChartWindow}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    <ext:Window ID="BusinessChartWindow" runat="server" Icon="ChartBar" Width="900" Height="600"
        Hidden="true" Modal="true" Constrain="true">
        <AutoLoad Url="/Day/BusinessChart/" Mode="IFrame" TriggerEvent="show" ReloadOnEvent="true"
            ShowMask="true">
            <Params>
                <ext:Parameter Name="range" Value="" Mode="Value" />
                <ext:Parameter Name="businessname" Value="" Mode="Value" />
            </Params>
        </AutoLoad>
        <Buttons>
            <ext:Button ID="Button5" runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{BusinessChartWindow}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderArea" runat="server">
    <style type="text/css">
        .x-grid3-cell-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid-group-hd div
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid3-hd-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
            font-size: 12px;
        }
        
        .x-grid3-body .x-grid3-td-Cost
        {
            background-color: #f1f2f4;
        }
        
        .x-grid3-summary-row .x-grid3-td-Cost
        {
            background-color: #e1e2e4;
        }
        
        .total-field
        {
            background-color: #fff;
            font-weight: bold !important;
            color: #000;
            border: solid 1px silver;
            padding: 2px;
            margin-right: 5px;
        }
    </style>
    <script type="text/javascript">
        var updateTotal = function (grid) {
            var fbar = grid.getBottomToolbar(),
                column,
                field,
                width,
                data = {},
                c,
                cs = grid.view.getColumnData();

            for (var j = 0, jlen = grid.store.getCount(); j < jlen; j++) {
                var r = grid.store.getAt(j);

                for (var i = 0, len = cs.length; i < len; i++) {
                    c = cs[i];
                    column = grid.getColumnModel().columns[i];

                    if (column.summaryType) {
                        data[c.name] = Ext.grid.GroupSummary.Calculations[column.summaryType](data[c.name] || 0, r, c.name, data);
                    }
                }
            }

            for (var i = 0; i < grid.getColumnModel().columns.length; i++) {
                column = grid.getColumnModel().columns[i];

                if (column.dataIndex != grid.store.groupField) {
                    field = fbar.findBy(function (item) {
                        return item.dataIndex === column.dataIndex;
                    })[0];

                    if (typeof (field) != 'undefined') {
                        c = cs[i];
                        fbar.remove(field, false);
                        fbar.insert(i, field);
                        width = grid.getColumnModel().getColumnWidth(i);
                        field.setWidth(width - 5);
                        field.setValue((column.summaryRenderer || c.renderer)(data[c.name], {}, {}, 0, i, grid.store));
                    }
                }
            }

            fbar.doLayout();
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="StartupArea" runat="server">
    <script type="text/javascript">
        var commandHandler = function (cmd, record) {
            switch (cmd) {
                case "userreport":
                    //debugger;
                    var win = UserCheckDetailsWindow;
                    win.autoLoad.url = '/Day/UserCheckReport/';
                    win.autoLoad.params.userid = record.data.UserID;
                    win.autoLoad.params.username = record.data.UserName;
                    win.autoLoad.params.rangestart = _rangestart;
                    win.autoLoad.params.rangeend = _rangeend;
                    win.autoLoad.params.level = _level;
                    //win.setTitle([record.data.CheckDate, ' '].join(''));
                    win.setTitle([formatCNDate(_rangestart), '至 ', formatCNDate(_rangeend), record.data.UserName + _leveltext + '的业务量统计'].join(' '));
                    win.show();
                    break;
            }
        };

        function showWorkloadTrendsChart(grain) {
            //debugger;
            var totalMonth = ((_rangeend.getFullYear() * 12) + (_rangeend.getMonth())) - ((_rangestart.getFullYear() * 12) + (_rangestart.getMonth())) + 1;
            var totalDay = parseInt(Math.abs(_rangeend - _rangestart) / 1000 / 60 / 60 / 24);
            var trueLength = true;
            var lengthConfirmMsg = '';
            switch (grain) {
                case 1:
                    if (totalDay <= 31) {
                        lengthConfirmMsg = ['您确认生成了从 ', formatCNDate(_rangestart), ' 到 ', formatCNDate(_rangeend), '（共', totalDay, '天）的日视图吗？'].join('');
                    } else {
                        trueLength = false;
                    }
                    break;
                case 2:
                    if (totalMonth <= 24) {
                        lengthConfirmMsg = ['您确认生成了从 ', formatCNDateYM(_rangestart), ' 到 ', formatCNDateYM(_rangeend), '（共', totalMonth, '个月）的月视图吗？'].join('');
                    } else {
                        trueLength = false;
                    }
                    break;
            }

            if (trueLength == true) {
                Ext.onReady(function () {
                    Ext.MessageBox.confirm('DailyReport', lengthConfirmMsg, callBack);
                    function callBack(id) {
                        //debugger;
                        if (id == 'yes') {
                            var win = WorkloadTrendsChartWindow;
                            win.autoLoad.url = '/Day/WorkloadTrendsChart/';
                            win.autoLoad.params.rangestart = _rangestart;
                            win.autoLoad.params.rangeend = _rangeend;
                            win.autoLoad.params.level = _level;
                            win.autoLoad.params.grain = grain;
                            win.setTitle([formatCNDate(_rangestart), '至 ', formatCNDate(_rangeend), _reportType + _leveltext + '工作量走势', "（" + getGrainText(grain) + "）"].join(' '));
                            win.show();
                        }
                    }
                });
            } else {
                var lengthErrMsg = '';
                switch (grain) {
                    case 1:
                        lengthErrMsg = '选择超过了31天，不能生成。';
                        break;
                    case 2:
                        lengthErrMsg = '选择超过了24个月，不能生成。';
                        break;
                }
                Ext.onReady(function () {
                    Ext.MessageBox.alert('DailyReport', lengthErrMsg, null);
                });
            }
        }

        function showWorkloadProportionChart() {
            var win = WorkloadProportionChartWindow;
            win.autoLoad.url = '/Day/WorkloadProportionChart/';
            win.autoLoad.params.rangestart = _rangestart;
            win.autoLoad.params.rangeend = _rangeend;
            win.autoLoad.params.level = _level;
            win.setTitle([formatCNDate(_rangestart), '至 ', formatCNDate(_rangeend), _reportType + _leveltext + '工作量比例'].join(' '));
            win.show();
        }

        var showBusinessChart = function (item, menuItem, e) {
            //debugger;
            var win = BusinessChartWindow;
            win.autoLoad.url = '/Day/BusinessChart/';
            win.autoLoad.params.rangestart = _rangestart;
            win.autoLoad.params.rangeend = _rangeend;
            win.autoLoad.params.level = _level;
            win.autoLoad.params.businessname = menuItem.text;
            win.setTitle([formatCNDate(_rangestart), '至 ', formatCNDate(_rangeend), menuItem.text, _leveltext + '业务量比较'].join(' '));
            win.show();
        }

        var saveData = function () {
            GridData.setValue(Ext.encode(gpMember.getRowsValues({ selectedOnly: false })));
        };

        var submitValue = function (grid, hiddenFormat, format) {
            //debugger;
            hiddenFormat.setValue(format);
            grid.submitData(false);
        };

        var rangeSelected = function (item, record, index) {
            //            chart.destroy();
            //            DrawChart();
        }

    </script>
</asp:Content>
